Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

247
Visualizações
JavaScript (glide.js) - Laravel Mix "type=module" needed and why?

I am using a Laravel application and Laravel Mix for asset building.

I was trying to use Glide.js this evening and did the following after installing glide.js via npm.

Within my resources/js/app.js file I have this contents:

require('./bootstrap');

import Glide from '@glidejs/glide'
new Glide('.glide').mount();

My webpack.mix.js filed which is compiled by Laravel Mix, looks like this:

mix.copyDirectory('resources/img', 'public/img')
    .js('resources/js/app.js', 'public/js')
    .version();

When I now load the frontend, my slider does not work - it throws an JS error : [Glide warn]: Root element must be a existing Html node

When I change my script tag from:

<script src="{{ mix src='js/app.js' }}"></script>

To

<script src="{{ mix src='js/app.js' }}" type="module"></script>

It works - but is this really necessary? I have never read about type=module in combination with mix. Is this always necessary once the main js has "import" statements?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda